package com.matrix.marketing.converter;

import com.matrix.api.marketing.vo.UserCouponVO;
import com.matrix.marketing.entity.CouponTemplate;
import com.matrix.marketing.entity.UserCoupon;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * @author 有点甜
 * @since 2025/8/5
 */
@Mapper
public interface MarketingConverter {

    MarketingConverter INSTANCE = Mappers.getMapper(MarketingConverter.class);

    @Mapping(source = "userCoupon.id", target = "id")
    @Mapping(source = "template.id", target = "templateId")
    @Mapping(source = "template.title", target = "title")
    @Mapping(source = "template.couponType", target = "couponType")
    @Mapping(source = "template.thresholdAmount", target = "thresholdAmount")
    @Mapping(source = "template.discountAmount", target = "discountAmount")
    @Mapping(source = "template.issuerType", target = "issuerType")
    @Mapping(source = "template.issuerId", target = "issuerId")
    @Mapping(source = "userCoupon.expireTime", target = "expireTime")
    UserCouponVO toUserCouponVO(UserCoupon userCoupon, CouponTemplate template);
}
